/*
 * GUIInit.cpp
 *
 *  Created on: 01.12.2011
 *      Author: Andrey Efimov
 *      Copyright: LGPL
 */

#include "GUIBase.h"

//--------------------------------------------------------------------------------
CGuiBase::CGuiBase()
{
	Visible = true;
	Enable = true;
	Name = "";
	Position.x = 0.0f;
	Position.y = 0.0f;
	Size.x = 0;
	Size.y = 0;
	Cursor = "";
	CheckMouse = CM_FALSE;
	Texture1 = 0;
	Texture2 = 0;
	Texture3 = 0;
	Texture4 = 0;
	Texture5 = 0;
}
GUI_ELEMENT* CGuiBase::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = "";
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CLabel::CLabel()
{
	Text = "";
}
GUI_ELEMENT* CLabel::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			//break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Text;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CEdit::CEdit()
{
	Text = "";
}
GUI_ELEMENT* CEdit::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			//break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Text;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CMemo::CMemo()
{
	Text = "";
	ScrollBars = false;
}
GUI_ELEMENT* CMemo::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			//break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Text;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CListBox::CListBox()
{
	Items = "";
	ItemIndex = -1;
	ScrollBars = false;
}
GUI_ELEMENT* CListBox::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Items;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CComboBox::CComboBox()
{
	Items = "";
	ItemIndex = -1;
	ScrollBars = false;
}
GUI_ELEMENT* CComboBox::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Items;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CButton::CButton()
{
	Text = "";
}

GUI_ELEMENT* CButton::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Text;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CCheckBox::CCheckBox()
{
	Text = "";
	Checked = false;
}
GUI_ELEMENT* CCheckBox::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		if (GetChecked() == true)
			ParamDraw->texture = GetTexture5();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Text;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
void CCheckBox::onClick()
{
	if ( Checked == true )
		Checked = false;
	else
		Checked = true;
}
//--------------------------------------------------------------------------------
CRadioButton::CRadioButton()
{
	Text = "";
	Checked = false;
	Group = -1;
}
GUI_ELEMENT* CRadioButton::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		if (GetChecked() == true)
			ParamDraw->texture = GetTexture5();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = Text;
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
void CRadioButton::onClick()
{
	//if ( Checked == false )
	//	Checked = true;
	//TODO Sdelat' pereklychenie Checked v grupe RadioButton'ov
}
//--------------------------------------------------------------------------------
CProgressBar::CProgressBar()
{
	Min = 0;
	Max = 100;
	Value = 0;
}
GUI_ELEMENT* CProgressBar::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			//break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = "";
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
CTrackBar::CTrackBar()
{
	Min = 0;
	Max = 100;
	Value = 0;
}
GUI_ELEMENT* CTrackBar::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = "";
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
GUI_ELEMENT* CPanel::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = "";
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
GUI_ELEMENT* CInventar::onDraw()
{
	GUI_ELEMENT* ParamDraw = new GUI_ELEMENT;
	ParamDraw->position.x = GetPosition().x;
	ParamDraw->position.y = GetPosition().y;
	ParamDraw->size.x = GetSize().x;
	ParamDraw->size.y = GetSize().y;
	if (GetEnable() == false)
		ParamDraw->texture = GetTexture2();
	else
		switch (GetCheckMouse())
		{
			break;case CM_FALSE:		ParamDraw->texture = GetTexture1();
			break;case CM_MOUSEDOWN:	ParamDraw->texture = GetTexture3();
			break;case CM_MOUSEMOVE:	ParamDraw->texture = GetTexture4();
			break;default:				ParamDraw->texture = GetTexture1();
			break;
		}
	ParamDraw->text = "";
	ParamDraw->positionText.x = 0;
	ParamDraw->positionText.y = 0;
	ParamDraw->sizeText.x = 0;
	ParamDraw->sizeText.y = 0;
	return ParamDraw;
}
//--------------------------------------------------------------------------------
